package net.jiastudy.biz.project.entity;

import java.util.Date;
import java.util.List;

import javax.validation.constraints.NotEmpty;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotations.TableField;

import net.jiastudy.biz.sys.entity.Dept;
import net.jiastudy.biz.user.entity.User;
import net.jiastudy.core.base.BaseEntity;

public class DeptProject extends BaseEntity<DeptProject> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@NotEmpty(message = "名称不能为空")
	private String name;
	private Long deptId;
	private Long deptHeadId;
	private String workName;
	private String workTarget;
	@JSONField(format = "yyyy-MM-dd")
	private Date endDate;
	
	private Long createdUserId;
	
	@TableField(exist = false)
	private List<DeptProjectMember> members;
	
	@TableField(exist = false)
	private List<DeptProjectWork> works;
	
	@TableField(exist = false)
	private List<DeptProjectMoney> money;
	
	@TableField(exist = false)
	private List<DeptProjectReport> reports;
	
	@TableField(exist = false)
	private Dept dept;
	
	@TableField(exist = false)
	private User createdUser;
	
	public List<DeptProjectReport> getReports() {
		return reports;
	}
	public void setReports(List<DeptProjectReport> reports) {
		this.reports = reports;
	}
	public Dept getDept() {
		if (null != deptId) {
			dept = new Dept();
			dept.setId(deptId);
			dept = dept.selectById();
		}
		return dept;
	}
	public void setDept(Dept dept) {
		this.dept = dept;
	}
	
	public User getCreatedUser() {
		if (null != createdUserId) {
			createdUser = new User();
			createdUser.setId(createdUserId);
			createdUser = createdUser.selectById();
		}
		return createdUser;
	}
	public void setCreatedUser(User createdUser) {
		this.createdUser = createdUser;
	}
	
	public Long getDeptId() {
		return deptId;
	}
	public void setDeptId(Long deptId) {
		this.deptId = deptId;
	}
	
	public List<DeptProjectMember> getMembers() {
		return members;
	}
	public void setMembers(List<DeptProjectMember> members) {
		this.members = members;
	}
	public List<DeptProjectWork> getWorks() {
		return works;
	}
	public void setWorks(List<DeptProjectWork> works) {
		this.works = works;
	}
	public List<DeptProjectMoney> getMoney() {
		return money;
	}
	public void setMoney(List<DeptProjectMoney> money) {
		this.money = money;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Long getDeptHeadId() {
		return deptHeadId;
	}
	public void setDeptHeadId(Long deptHeadId) {
		this.deptHeadId = deptHeadId;
	}
	public String getWorkName() {
		return workName;
	}
	public void setWorkName(String workName) {
		this.workName = workName;
	}
	public String getWorkTarget() {
		return workTarget;
	}
	public void setWorkTarget(String workTarget) {
		this.workTarget = workTarget;
	}
	public Date getEndDate() {
		return endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	public Long getCreatedUserId() {
		return createdUserId;
	}
	public void setCreatedUserId(Long createdUserId) {
		this.createdUserId = createdUserId;
	}

	public User getDeptHeadUser() {
		if (null != deptHeadId) {
			User user = new User();
			user = user.selectById(deptHeadId);

			return user;
		}

		return null;
	}
}
